package com.ry.est.controller;

import com.ry.est.dto.ClassifyDTO;
import com.ry.est.dto.CommonResult;
import com.ry.est.service.ClassifyService;
import com.ry.est.util.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 主页控制器组件
 */
@Api(tags = "主页数据接口")
@RestController
public class HomeController {
    @Autowired
    private ClassifyService classifyService;


    @ApiOperation("获取分类数据")
    @GetMapping("/api/home/classifyTree")
    public CommonResult<List<ClassifyDTO>> getClassifyTree(){
        List<ClassifyDTO> data = classifyService.listClassifyTree();
        return ResultUtil.
                success(data);
    }
}
